package com.woniuxy.course.mapper;

import com.woniuxy.commons.entity.CourseChapter;
import com.woniuxy.commons.entity.Courseware;
import com.woniuxy.commons.entity.CoursewareChapter;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author LuoChen
 * @DateTime 2020-08-03 09:52:45
 * @Description
 */
@Mapper
@Repository
public interface CourseChapterMapper {

    /**
     * 根据章节id查找课件
     * @param cpid
     * @return: java.util.List<com.woniuxy.commons.entity.Courseware>
     * @author: LuoChen
     * @dateTime: 2020-08-03 09:54:11
     */
    List<Courseware> findCoursewareByCpid (int cpid);

    /**
     * 根据课程id查找章节
     * @param cid
     * @return: java.util.List<com.woniuxy.commons.entity.CourseChapter>
     * @author: LuoChen
     * @dateTime: 2020-08-03 17:47:54
     */
    List<CourseChapter> findChaptersByCid (int cid);

    /**
     * 批量增加章节
     * @param courseChapters
     * @return: int
     * @author: LuoChen
     * @dateTime: 2020-08-04 16:03:46
     */
    int addNewChapters (List<CourseChapter> courseChapters);

    /**
     * 课件和章节的映射
     * @param coursewareChapters
     * @return: int
     * @author: LuoChen
     * @dateTime: 2020-08-04 16:09:31
     */
    int addRelation (List<CoursewareChapter> coursewareChapters);
}
